package com.myres.struts2.action;
import java.util.HashMap;
import java.util.List;
import java.util.Map;



import com.myres.dao.CategoryDao;
import com.myres.model.Category;

import com.opensymphony.xwork2.ActionSupport;

public class LinkToAddProduct extends ActionSupport {
	private CategoryDao cdao;
    public CategoryDao getCdao() {
		return cdao;
	}
	public void setCdao(CategoryDao cdao) {
		this.cdao = cdao;
	}
	Map<Integer,String> categories;
    public Map<Integer, String> getCategories() {
		return categories;
	}
	public void setCategories(Map<Integer, String> categories) {
		this.categories = categories;
	}
	public Map<Integer, String> getSeries() {
		return series;
	}
	public void setSeries(Map<Integer, String> series) {
		this.series = series;
	}
	Map<Integer,String> series;
	/**
	 * @return
	 */
	public String execute() {
		// TODO Auto-generated method stub
		List<Category>  cates= cdao.findAll();
		if(categories ==null) categories =new HashMap<Integer,String>();
		for(Category cate:cates){
			System.out.println(cate.getId()+","+cate.getName()+","+cate.getIcon());
			categories.put(cate.getId(), cate.getName());
		}
		if(series ==null) series =new HashMap<Integer,String>();
		return SUCCESS;
	}
}